package com.demo.web;

import lombok.extern.slf4j.Slf4j;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cglib.proxy.Enhancer;
import org.springframework.cglib.proxy.MethodInterceptor;
import org.springframework.cglib.proxy.MethodProxy;

import java.lang.reflect.Method;
import java.util.ArrayList;
import java.util.Random;

@SpringBootApplication
@Slf4j
public class HeapSpaceOOM {

    public static void main(String[] args) {
        // 运行本程序之前请先设置VM Options
        //  -Xms100m -Xmx100m  -XX:+PrintGCDetails
        // Exception in thread "main" java.lang.OutOfMemoryError: Java heap space
        ArrayList<Integer> num = new ArrayList<>();

        while (true) {
            Random random = new Random();
            int i = random.nextInt(100);
            num.add(i);
        }

    }

}
